angular.module(moduleName)

.config(function($stateProvider, $urlRouterProvider) {

  // Ionic uses AngularUI Router which uses the concept of states
  // Learn more here: https://github.com/angular-ui/ui-router
  // Set up the various states which the app can be in.
  // Each state's controller can be found in controllers.js
  $stateProvider

    .state('login', {
    url: '/login',
    hiddenHeader: true,
    hiddenTabs: true,
    title: '登录',
    templateUrl: 'pages/login/login.html',
    controller: 'LoginCtrl',
    controllerAs: 'login'
  })

  .state('tab', {
      url: '/tab',
      abstract: true,
      templateUrl: 'pages/system/tab/tab.html',
      controller: 'TabCtrl',
      controllerAs: 'vm'
    })
    // 首页
    .state('tab.home', {
      url: '/home',
      title: '首页',
      hiddenHeader: true,
      views: {
        'tab-home': {
          templateUrl: 'pages/home/home/home.html',
          controller: 'HomeCtrl',
          controllerAs: 'vm'
        }
      }
    })
    // 建议书列表
    .state('suggestList', {
      url: '/suggestList',
      hiddenTabs: true,
      title: '建议书',
      templateUrl: 'pages/home/suggestList/suggestList.html',
      controller: 'SuggestListCtrl',
      controllerAs: 'vm'
    })
    // 产品清单
    .state('productList', {
      url: '/productList',
      hiddenTabs: true,
      title: '产品清单',
      templateUrl: 'pages/home/productList/productList.html',
      controller: 'ProductListCtrl',
      controllerAs: 'productList'
    })
    //填写建议书
    .state('makeSuggest', {
      url: '/makeSuggest',
      hiddenTabs: true,
      title: '填写建议书',
      templateUrl: 'pages/home/makeSuggest/makeSuggest.html',
      controller: 'MakeSuggestCtrl',
      controllerAs: 'vm'
    })

  //展示建议书
  .state('showSuggest', {
    url: '/showSuggest',
    hiddenTabs: true,
    title: "投保",
    templateUrl: 'pages/home/showSuggest/showSuggest.html',
    controller: 'ShowSuggestCtrl',
    controllerAs: 'showSuggest'
  })

  // 公司介绍
  .state('company', {
    url: '/company',
    hiddenTabs: true,
    title: "公司介绍",
    templateUrl: 'pages/home/company/company.html',
    controller: 'CompanyCtrl',
    controllerAs: 'company'
  })

  // 财务规划-个人信息
  .state('financeBaseInfo', {
    url: '/financeBaseInfo',
    hiddenTabs: true,
    title: "财务规划",
    templateUrl: 'pages/home/financeBaseInfo/financeBaseInfo.html',
    controller: 'FinanceBaseInfoCtrl',
    controllerAs: 'vm'
  })

  // 财务规划-债务信息
  .state('financeDebtInfo', {
    url: '/financeDebtInfo',
    hiddenTabs: true,
    title: "财务规划",
    templateUrl: 'pages/home/financeDebtInfo/financeDebtInfo.html',
    controller: 'FinanceDebtInfoCtrl',
    controllerAs: 'vm'
  })

  // 财务规划-定制结果
  .state('financeResult', {
    url: '/financeResult',
    hiddenTabs: true,
    title: "财务规划",
    templateUrl: 'pages/home/financeResult/financeResult.html',
    controller: 'FinanceResultCtrl',
    controllerAs: 'vm'
  })

  // 行事历
  .state('calendar', {
    url: '/calendar',
    hiddenTabs: true,
    hiddenHeader: true,
    title: "行事历",
    templateUrl: 'pages/home/calendar/calendar.html',
    controller: 'CalendarCtrl',
    controllerAs: 'calendar'
  })

  //积分商场
  .state('pointMall', {
    url: '/pointMall',
    hiddenTabs: true,
    title: "积分商场",
    templateUrl: 'pages/home/pointMall/pointMall.html',
    controller: 'PointMallCtrl',
    controllerAs: 'vm'
  })

  //帮助中心
  .state('helpCenter', {
      url: '/helpCenter',
      title: '帮助中心',
      hiddenTabs: true,
      templateUrl: 'pages/home/helpCenter/helpCenter.html',
      controller: 'HelpCenterCtrl',
      controllerAs: 'vm'

    })
    //帮助列表
    .state('helpList', {
      url: '/helpList',
      title: '在线帮助',
      hiddenTabs: true,
      templateUrl: 'pages/home/helpList/helpList.html',
      controller: 'HelpListCtrl',
      controllerAs: 'vm'

    })
    //在线帮助
    .state('helpOnline', {
      url: '/helpOnline',
      title: '在线帮助',
      hiddenTabs: true,
      templateUrl: 'pages/home/helpOnline/helpOnline.html',
      controller: 'HelpOnlineCtrl',
      controllerAs: 'vm'
    })
    // 学习
    .state('tab.study', {
      url: '/study',
      title: '学习',
      hiddenBack: true,
      views: {
        'tab-study': {
          templateUrl: 'pages/study/study/study.html',
          controller: 'StudyCtrl',
          controllerAs: 'study'
        }
      }
    })
    // 我的
    .state('tab.my', {
      url: '/my',
      title: '我的',
      hiddenBack: true,
      views: {
        'tab-my': {
          templateUrl: 'pages/my/my/my.html',
          controller: 'MyCtrl',
          controllerAs: 'my'
        }
      }
    })
    // 消息
    .state('message', {
      url: '/message',
      title: '消息',
      hiddenTabs: true,
      templateUrl: 'pages/my/message/message.html',
      controller: 'MessageCtrl',
      controllerAs: 'message'
    })
    // 我的业绩
    .state('performance', {
      url: '/performance',
      title: '我的业绩',
      hiddenTabs: true,
      templateUrl: 'pages/my/performance/performance.html',
      controller: 'PerformanceCtrl',
      controllerAs: 'performance'
    })
    // 保单列表
    .state('policy', {
      url: '/policy',
      title: '保单列表',
      hiddenTabs: true,
      templateUrl: 'pages/my/policy/policy.html',
      controller: 'PolicyCtrl',
      controllerAs: 'policy'
    })
    // 保单详情
    .state('policyDetail', {
      url: '/policy-detail',
      title: '保单详情',
      hiddenTabs: true,
      templateUrl: 'pages/my/policy/policy-detail/policy-detail.html',
      controller: 'PolicyDetailCtrl',
      controllerAs: 'policyDetail'
    })
    // 拜访统计
    .state('statistics', {
      url: '/statistics',
      title: '拜访统计',
      hiddenTabs: true,
      templateUrl: 'pages/my/statistics/statistics.html',
      controller: 'StatisticsCtrl',
      controllerAs: 'vm'
    })
    // 我的报聘
    .state('recruitInfo', {
      url: '/recruitInfo',
      title: '我的报聘',
      hiddenTabs: true,
      templateUrl: 'pages/my/recruitInfo/recruitInfo.html',
      controller: 'RecruitInfoCtrl',
      controllerAs: 'vm'
    })
    // 人事管理
    .state('personManage', {
      url: '/personManage',
      title: '人事管理',
      hiddenTabs: true,
      templateUrl: 'pages/my/personManage/personManage.html',
      controller: 'PersonManageCtrl',
      controllerAs: 'personManage'
    })
    //客户管理
    .state('tab.customer', {
      url: '/customer',
      title: '客户管理',
      hiddenBack: true,
      views: {
        'tab-customer': {
          templateUrl: 'pages/customer/customer/customer.html',
          controller: 'CustomerCtrl',
          controllerAs: 'customer'
        }
      }
    })
    //展业获客
    .state('promote-business',{
      title:'展业获客',
      url:'/customer/promote-business',
      templateUrl:'pages/customer/promote-business/promote-business.html',
      controller:'PromoteBusinessCtrl',
      controllerAs:'promoteBusiness'
    })
    //我的收藏
    .state('my-collection',{
      title:'我的收藏',
      url:'/my/collection',
      templateUrl:'pages/my/collection/collection.html',
      controller:'CollectionCtrl',
      controllerAs:'collection'
    })
    //客户信息
    .state('customer-detail',{
      title:'客户详情',
      url:'/customer/detail',
      templateUrl:'pages/customer/customerInfo/customerInfo.html',
      controller:'CustomerInfoCtrl',
      controllerAs:'customerInfo'
    })
    //报聘上传
    .state('recruit-upload',{
      title:'报聘上传',
      url:'/recruit/upload',
      templateUrl:'pages/my/recruitUpload/recruitUpload.html',
      controller:'RecruitUploadCtrl',
      controllerAs:'vm'
    })
    //上传成功
    .state('upload-success',{
      title:'报聘证件上传',
      url:'/upload/success',
      templateUrl:'pages/my/uploadSuccess/uploadSuccess.html',
      controller:'UploadSuccessCtrl',
      controllerAs:'vm'
    })
    //信息录入
    .state('info-entry',{
      title:'投保人信息',
      url:'/info-entry',
      templateUrl:'pages/customer/info-entry/info-entry.html',
      controller:'InfoEntryCtrl',
      controllerAs:'infoEntry',
      cache: false
    })
    //投保
    .state('product-purchase-info', {
      title: '投保信息录入',
      url: '/product/purchase/info',
      templateUrl: 'pages/home/productPurchaseInfo/productPurchaseInfo.html',
      controller: 'productPurchaseInfoCtrl',
      controllerAs: 'productPurchaseInfo'
    });

    // if none of the above states are matched, use this as the fallback
    $urlRouterProvider.otherwise('/login');

});
